<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var obj={
        name:"刘沂松",
        age:22,
        sex:"男",
        from:"河南",
        height:"183",
        weight:"130",
        hobby:["打游戏","旅游"],
        dream:"自驾游",
        sayHello:function(){
            console.log("hai");
        }
    }
    console.log(obj);
    console.log(obj.age);
    console.log(obj.sayHello);
    console.log(obj.coordinate);
    obj.coordinate="上海宝山"
    console.log(obj.coordinate);
    console.log(obj.hobby);
    obj.hobby="买车买房"
    console.log(obj.hobby);
    delete obj.sex;


    function fn(n){
        if(n%2===0){
            var sum=0;
            for(var i=2;i<=n;i+=2){
                sum+=1/i;
            }
            return sum;
        }else{
            var sum=0;
            for(var i=1;i<=n;i+=2){
                sum+=1/i;
            }
            return sum
        }
    }
    console.log(fn(3));


</script>
</html>